def count(x):
    """like len(), but also works for iters."""
    try:
        return len(x)
    except:
        n = 0
        for i in x:
            n += 1
        return n
